/****** Object:  Stored Procedure [dbo].spLuuKhoInsert Script Date: 8/7/2012 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[spLuuKhoInsert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spLuuKhoInsert]
GO

/******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:					Description:
**		--------	--------				-----------------------------------
**		07/08/2012	SongTM					Innit created
*******************************************************************************/

CREATE PROCEDURE [dbo].[spLuuKhoInsert]
(
	@MaLuuKho int output,
	@MaThuoc nvarchar(12),
	@SoLo nvarchar(12),
	@MaKho nvarchar(5),
	@TongNhap int,
	@TongXuat int,
	@TonKho int,
	@HanDung nvarchar(50),
	@NgaySX datetime,
	@HanSuDung datetime
	
)
WITH ENCRYPTION

AS

SET NOCOUNT ON

INSERT INTO [tbl_LuuKho]
(
	[MaThuoc],
	[SoLo],
	[MaKho],
	[TongNhap],
	[TongXuat],
	[TonKho],
	[HanDung],
	[NgaySX],
	[HanSuDung]
)
VALUES
(
	@MaThuoc,
	@SoLo,
	@MaKho,
	@TongNhap,
	@TongXuat,
	@TonKho,
	@HanDung,
	@NgaySX,
	@HanSuDung
)

SELECT @MaLuuKho = SCOPE_IDENTITY()
--SELECT @Id = @@IDENTITY
GO

--GRANT EXECUTE ON [dbo].[spLuuKhoInsert] TO [sa]
--GO
